lib/commit: Ensure bare-user objects are always user-readable
authorColin Walters <walters@verbum.org>
Fri, 30 Jun 2017 13:40:47 +0000 (09:40 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 30 Jun 2017 21:23:48 +0000 (21:23 +0000)
commit3348baf6eb69be0ec8ac3138e696e2828a0cc9e3
treebcf173e43a207b31987bdb0d30d9dac6851f6fae
parentcd7d35945af7c11891919b2f2ffae65532b0af31
lib/commit: Ensure bare-user objects are always user-readable

Some of the Jenkins jobs for Fedora Atomic Host broke after updating
to 2017.7, and it turns out that we regressed handling unreadable
files in `bare-user` mode.  An example of this is `/etc/shadow`, which
ends up in the ostree-as-host content as `/usr/etc/shadow`.

Now there are better fixes here; we should probably delete it and create it
during the config merge if it doesn't exist.  In general, having secret files in
ostree really isn't supported, so it doesn't make sense to include them.

But let's fix this regression - when operating as an unprivileged user we don't
have `CAP_DAC_OVERRIDE` and hence will fail to open un-user-readable objects.

(We still preserve the actual `0` mode of course in the xattr and will
 apply it in `bare`)

Closes: #989
Approved by: jlebon
src/libostree/ostree-repo-commit.c
tests/test-basic-user.sh